// Author: Gehad
dojo.declare("myGrid", null, {
  constructor: function(args){
    dojo.safeMixin(this, args);  
},
setLayout: function(layout){
	this.layout=layout;
},
setStore: function(url){
	this.store=new dojox.data.JsonRestStore({target:url,syncMode:true});
	
},
createGrid: function(){
	this.grid = new dojox.grid.EnhancedGrid({
                    store: this.store,
                    rowSelector: '0px',
		    width: 'auto',
		    structure: this.layout,
			 plugins: {
                        pagination: {
                            pageSizes: false,                            // Array, custom the items per page menu
                            // itemTitle: "entrys",         // String, custom the item' title of description
                            description: true,
                            sizeSwitch: true,
                            pageStepper: true ,
                                        maxPageStep: 7,         // Integer, custom how many page step will be displayed
                                        position: "bottom"      // String, custom the position of the pagination bar
                                }
                        }                    
		},
		document.createElement('div'));
},
addGrid: function(container){
	dojo.byId(container).innerHTML='';
dojo.byId(container).innerHTML='';                
	 dojo.byId(container).appendChild(this.grid.domNode);
         this.grid.startup();
},
updateStore: function(url){
if(this.grid.store.save) {
   this.grid.store.save();
}
this.grid.store.close();
this.grid.store=new dojox.data.JsonRestStore({target:url,syncMode:true});
this.grid._refresh();
}
});

